if (!_etagStorageFilter.isEmpty()) {
// If we are a directory that should not be read from db next time, don't write the etag
QByteArray prefix = record._path + "/";
- for (const auto &it : _etagStorageFilter) {
+ for (const auto &it : std::as_const(_etagStorageFilter)) {
if (it.startsWith(prefix)) {
qCInfo(lcDb) << "Filtered writing the etag of" << prefix << "because it is a prefix of" << it;
record._etag = "_invalid_";
void FolderMan::scheduleAllFolders()
{
const auto folderMapValues = _folderMap.values();
- for (auto *f : folderMapValues) {
+ for (const auto f : folderMapValues) {
if (f && f->canSync()) {
scheduleFolder(f);
}
{
if (_currentEtagJob.isNull()) {
Folder *folder = nullptr;
- for (auto *f : std::as_const(_folderMap)) {
+ for (const auto f : std::as_const(_folderMap)) {
if (f->etagJob()) {
// Caveat: always grabs the first folder with a job, but we think this is Ok for now and avoids us having a separate queue.
_currentEtagJob = f->etagJob();
qCInfo(lcFolderMan) << "Account" << accountName << "connected, scheduling its folders";
const auto folderMapValues = _folderMap.values();
- for (auto *f : folderMapValues) {
+ for (const auto f : folderMapValues) {
if (f
&& f->canSync()
&& f->accountState() == accountState) {
"terminating or descheduling sync folders";
const auto folderValues = _folderMap.values();
- for (auto *f : folderValues) {
+ for (const auto f : folderValues) {
if (f
&& f->isSyncRunning()
&& f->accountState() == accountState) {
serverPath.prepend('/');
const auto mapValues = map().values();
- for (auto *folder : mapValues) {
+ for (const auto folder : mapValues) {
if (acc && folder->accountState()->account() != acc) {
continue;
}
auto runSeen = false;
auto various = false;
- for (const auto *folder : std::as_const(folders)) {
+ for (const auto folder : std::as_const(folders)) {
// We've already seen an error, worst case met.
// No need to check the remaining folders.
if (errorsSeen) {
{
// Note that the setting will revert to 'true' if all folders
// are deleted...
- for (auto *folder : std::as_const(_folderMap)) {
+ for (const auto folder : std::as_const(_folderMap)) {
folder->setIgnoreHiddenFiles(ignore);
folder->saveToSettings();
}
}
QStringList sortedList = list;
Utility::sortFilenames(sortedList);
- for ( auto path : sortedList) {
+ for (auto path : sortedList) {
path.remove(webdavFolder);
// Don't allow to select subfolders of encrypted subfolders
// We need to force a remote discovery after a change of the ignore list.
// Otherwise we would not download the files/directories that are no longer
// ignored (because the remote etag did not change) (issue #3172)
- for (auto *folder : std::as_const(folderMan->map())) {
+ for (const auto folder : std::as_const(folderMan->map())) {
folder->journalDb()->forceRemoteDiscoveryNextSync();
folderMan->scheduleFolder(folder);
}
// list of top-level folders as soon as possible.
if (_oldBlackList == QStringList("/")) {
_oldBlackList.clear();
- for (QString path : std::as_const(list)) {
+ for (auto path : std::as_const(list)) {
path.remove(pathToRemove);
if (path.isEmpty()) {
continue;
}
Utility::sortFilenames(list);
- for (QString path : std::as_const(list)) {
+ for (auto path : std::as_const(list)) {
auto size = job ? job->_folderInfos[path].size : 0;
path.remove(pathToRemove);
} else {
// We did not load from the server so we reuse the one from the old black list
QString path = root->data(0, Qt::UserRole).toString();
- for (const QString &it : _oldBlackList) {
+ for (const auto &it : _oldBlackList) {
if (it.startsWith(path))
result += it;
}
QString background(palette().base().color().name());
_toolBar->setStyleSheet(TOOLBAR_CSS().arg(background, dark, highlightColor, highlightTextColor));
- for (const auto &a : _actionGroup->actions()) {
+ for (const auto a : _actionGroup->actions()) {
QIcon icon = Theme::createColorAwareIcon(a->property("iconPath").toString(), palette());
a->setIcon(icon);
auto *btn = qobject_cast<QToolButton *>(_toolBar->widgetForAction(a));
*/
static void updateFolder(const AccountPtr &account, QStringView path)
{
- for (auto *f : std::as_const(FolderMan::instance()->map())) {
+ for (auto f : std::as_const(FolderMan::instance()->map())) {
if (f->accountState()->account() != account)
continue;
auto folderPath = f->remotePath();
[=](const QJsonDocument &reply) {
// Find existing share permissions (if this was shared with us)
Share::Permissions existingPermissions = SharePermissionAll;
- for (const QJsonValue &element : reply.object()["ocs"].toObject()["data"].toArray()) {
+ for (const auto &element : reply.object()["ocs"].toObject()["data"].toArray()) {
auto map = element.toObject();
if (map["file_target"] == path)
existingPermissions = Share::Permissions(map["permissions"].toInt());
}
auto actions = json.value("actions").toArray();
- for (const auto action : actions) {
+ for (const auto &action : actions) {
activity._links.append(ActivityLink::createFomJsonObject(action.toObject()));
}
}
_preFetchEtagHeader = postFetchEtagHeader;
- auto notifies = json.object().value("ocs").toObject().value("data").toArray();
+ const auto notifies = json.object().value("ocs").toObject().value("data").toArray();
auto *ai = qvariant_cast<AccountState *>(sender()->property(propertyAccountStateC));
ActivityList list;
ActivityList callList;
- for (const auto element : std::as_const(notifies)) {
+ for (const auto element : notifies) {
auto json = element.toObject();
auto a = Activity::fromActivityJson(json, ai->account());
void Account::slotDirectEditingRecieved(const QJsonDocument &json)
{
auto data = json.object().value("ocs").toObject().value("data").toObject();
- auto editors = data.value("editors").toObject();
+ const auto editors = data.value("editors").toObject();
for (const auto &editorKey : editors.keys()) {
auto editor = editors.value(editorKey).toObject();
DirectEditor* Capabilities::getDirectEditorForMimetype(const QMimeType &mimeType)
{
- for (auto* editor : std::as_const(_directEditors)) {
+ for (const auto editor : std::as_const(_directEditors)) {
if(editor->hasMimetype(mimeType))
return editor;
}
DirectEditor* Capabilities::getDirectEditorForOptionalMimetype(const QMimeType &mimeType)
{
- for (auto* editor : std::as_const(_directEditors)) {
+ for (const auto editor : std::as_const(_directEditors)) {
if(editor->hasOptionalMimetype(mimeType))
return editor;
}
} else {
char invalid = '\0';
constexpr QByteArrayView invalidChars("\\:?*\"<>|");
- for (char x : invalidChars) {
+ for (const auto x : invalidChars) {
if (item->_file.contains(x)) {
invalid = x;
break;
}
int started = 0;
- for (auto *rj : std::as_const(_runningJobs)) {
+ for (const auto rj : std::as_const(_runningJobs)) {
started += rj->processSubJobs(nbJobs - started);
if (started >= nbJobs)
return started;
}
}
- for (auto *it : std::as_const(directoriesToRemove)) {
+ for (const auto it : std::as_const(directoriesToRemove)) {
_rootJob->appendDirDeletionJob(it);
}
// checkForPermissions() has already run and used the permissions
// of the file we're about to delete to decide whether uploading
// to the new dir is ok...
- for (const SyncFileItemPtr &dirItem : items) {
+ for (const auto &dirItem : items) {
if (dirItem->destination().startsWith(item->destination() + "/")) {
dirItem->_instruction = CSYNC_INSTRUCTION_NONE;
_anotherSyncNeeded = true;
qint64 PropagatorCompositeJob::committedDiskSpace() const
{
qint64 needed = 0;
- for (auto *job : std::as_const(_runningJobs)) {
+ for (const auto job : std::as_const(_runningJobs)) {
needed += job->committedDiskSpace();
}
return needed;
{
if (!_runningJobs.empty()) {
_abortsCount = _runningJobs.size();
- for (auto *j : std::as_const(_runningJobs)) {
+ for (const auto j : std::as_const(_runningJobs)) {
if (abortType == AbortType::Asynchronous) {
connect(j, &PropagatorJob::abortFinished,
this, &PropagatorCompositeJob::slotSubJobAbortFinished);
};
// Abort all running jobs, except for explicitly excluded ones
- for (auto *job : std::as_const(_jobs)) {
+ for (const auto job : std::as_const(_jobs)) {
auto reply = job->reply();
if (!reply || !reply->isRunning())
continue;
ProblemsMap oldProblems;
std::swap(_syncProblems, oldProblems);
- for (const SyncFileItemPtr &item : std::as_const(items)) {
+ for (const auto &item : std::as_const(items)) {
qCInfo(lcStatusTracker) << "Investigating" << item->destination() << item->_status << item->_instruction << item->_direction;
_dirtyPaths.remove(item->destination());